
var websocketRoot = "ws://" + window.location.host;
console.log("websocketRoot:", websocketRoot);
var websocketTool = {
  assistUri: websocketRoot + "/initWs",
  socket: {},
  checkSocket: {},
  userInfoMap: {},
  groupMap: {},
  init: function () {
    var that = this;
    this.resetSocket();
  },
  resetSocket: function () {
    var that = this;
    this.checkSocket = new WebSocket(this.assistUri);
    this.checkSocket.onopen = function (event) {
      console.log('the checkSocket is open..............')
    };
    this.checkSocket.onmessage = function (event) {
      console.log("接受到消息：："+event.data);
      document.getElementById("show").innerHTML = document.getElementById("show").innerHTML+"<br/>"+event.data;
    };
  },
  sendMessage: function (message) {

      this.checkSocket.send(message);
  }

};